<%-- 
    Document   : editProfile
    Created on : 12.5.2009, 0:45:39
    Author     : Ediczech
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <%@include file="view/header.jsp" %>

    <%-- Content --%>

    <h2><h:outputText value="#{msg.editProfile_title}"/></h2>

    <a4j:form id="EditProfile" prependId="">
            <h:panelGrid columns="3">
                <h:outputText value="#{msg.user_nickname}:" />
                <h:inputText id="Nickname" value="#{EditProfileBean.user.nick}"
                             size="15" required="true">
                    <f:validateLength minimum="3" maximum="12"/>
                </h:inputText>
                <h:message for="Nickname" errorClass="message_error"/>

                <h:outputText value="#{msg.user_firstname}:" />
                <h:inputText id="Firstname" value="#{EditProfileBean.user.firstname}"
                             size="15" required="true">
                    <f:validateLength minimum="3" maximum="20"/>
                </h:inputText>
                <h:message for="Firstname" errorClass="message_error"/>

                <h:outputText value="#{msg.user_lastname}:" />
                <h:inputText id="Lastname" value="#{EditProfileBean.user.lastname}"
                size="15" required="true">
                    <f:validateLength minimum="3" maximum="30"/>
                </h:inputText>
                <h:message for="Lastname" errorClass="message_error"/>

                <h:outputText value="#{msg.user_email}:" />
                <h:inputText id="Email" value="#{EditProfileBean.user.email}"
                size="15" required="true">
                    <f:validateLength minimum="8" maximum="32"/>
                    <f:validator validatorId="emailValidator"/>
                </h:inputText>
                <h:message for="Email" errorClass="message_error"/>

                <%--TODO v0.2 for Ediczech: uzivatel nechce menit heslo porad--%>

                <h:outputText value="#{msg.user_password}:" />
                <h:inputSecret id="Password" value="#{EditProfileBean.user.password}"
                size="15" required="true">
                    <f:validateLength minimum="4" maximum="32"/>
                </h:inputSecret>
                <h:message for="Password" errorClass="message_error"/>

                <h:outputText value="#{msg.user_passCheck}:" />
                <h:inputSecret id="PassCheck" value="#{EditProfileBean.password}" size="15" required="true">
                    <f:validateLength minimum="4" maximum="32"/>
                    <f:validator validatorId="passwordValidator"/>
                    <f:attribute name="passwordId" value="EditProfile:Password" />
                </h:inputSecret>
                <h:message for="PassCheck" errorClass="message_error"/>
                </h:panelGrid>

            <h:panelGrid>
                <h:messages errorClass="message_error" globalOnly="true"/>
                <h:commandButton action="#{EditProfileBean.save}" value="#{msg.editProfile_button}"/>
            </h:panelGrid>
    </a4j:form>

    <%-- Content --%>

    <%@include file="view/footer.jsp" %>
</f:view>